#include "PerspectiveCamera.h"
#include <memory.h>
#include <cmath>
using namespace std;

CPerspectiveCamera::CPerspectiveCamera(void)
{
}

CPerspectiveCamera::~CPerspectiveCamera(void)
{
}

void CPerspectiveCamera::Init(Vector3f vPos, float fFov, float fWidth, float fHeight,
                              Vector3f vUP, Vector3f vFront)
{
    m_vPosition = vPos;
 
    m_fDistance = vPos.z;
    m_ffovScale = 2 * m_fDistance * tan((fFov / 2 * 3.1416) / 180.0);

    m_vUp = vUP;
    Normalize(m_vUp);

    m_vFront = vFront;
    Normalize(m_vFront);

    // Notice: OpenGL is a right-hand-coordinate system.
    m_vRight = Cross(m_vFront, m_vUp);
    Normalize(m_vRight);


}